require 'family_tree_api/person/assertions/base'
module FamilyTreeApi
  module Person
    module Assertion
      
      class Gender < Base
        attr_accessor :value
        
        def initialize(value = nil, options = {})
          @notes = []
          @value = value unless value.nil?
          @tempId = options[:tempId] if options[:tempId]
        end
        
        def self.parse(gender_element)
          gender = Gender.new
          gender.parse_attributes(gender_element)
          gender_element.each do |e|
            gender.value = e.content if e.name == 'value'
          end
          gender
        end
        
        def to_xml
          e = super
          e.add_element('value').add_text(@value)
          e
        end

      end
      
    end
  end
end